package com.tuweiya.study.springmvc002.eventBus.bus;

import com.google.common.base.Joiner;
import com.google.common.eventbus.AsyncEventBus;

import java.util.Arrays;
import java.util.concurrent.Executors;

/**
 * @Author: Mr_tu
 * @Date: Create in 16:53 2018/6/7
 * @Description: 事件三要素：事件源
 */
public class SendEventBus {

//    private final static EventBus shortMsgEventBus = new EventBus();
    private final static AsyncEventBus shortMsgEventBus = new AsyncEventBus(Executors.newFixedThreadPool(100));

    public static void post(Object event){
        shortMsgEventBus.post(event);
    }

    public static void register(Object object){
        shortMsgEventBus.register(object);
    }

    public static void unRegister(Object object){
        shortMsgEventBus.unregister(object);
    }

    // Bus的name
    public static String identifier(){
        return shortMsgEventBus.identifier();
    }
}
